package com.hyt.it.ogt.kq.common.gov.utils;

import org.apache.commons.lang3.StringUtils;

import com.hyt.it.ogt.kq.common.gov.enums.CacheKeyEnum;

/**
 * redis缓存key定义类
 *
 * 已过期 请使用 {@link CacheKeyEnum}
 */
@Deprecated
public class CacheKeyManager {
    //统一分隔符
    public static final String CACHE_SEPARATOR = ":";
    //准考证
    public static final String CREATE_ADMISSION_TICKET_KEY = "CREATE_ADMISSION_TICKET_KEY";
    //生成考务包事务key
    public static final String CREATE_ROOM_DATA_KEY = "CREATE_ROOM_DATA_KEY";
    //生成模拟测试考务包事务key
    public static final String CREATE_MOCK_ROOM_DATA_KEY = "CREATE_MOCK_ROOM_DATA_KEY";
    //生成考务包过程总量key
    public static final String CREATE_ROOM_DATA_PROGRESS_TOTAL_KEY = "CREATE_ROOM_DATA_PROGRESS_TOTAL_KEY";
    //生成模拟测试考务包过程总量key
    public static final String CREATE_MOCK_ROOM_DATA_PROGRESS_TOTAL_KEY = "CREATE_MOCK_ROOM_DATA_PROGRESS_TOTAL_KEY";
    //生成考务包过程完成数量key
    public static final String CREATE_ROOM_DATA_PROGRESS_KEY = "CREATE_ROOM_DATA_PROGRESS_KEY";
    //生成模拟测试考务包过程完成数量key
    public static final String CREATE_MOCK_ROOM_DATA_PROGRESS_KEY = "CREATE_MOCK_ROOM_DATA_PROGRESS_KEY";
    //导出准考证事务key
    public static final String EXPORT_ADMISSION_TICKET_KEY = "EXPORT_ADMISSION_TICKET_KEY";
    //获取导出准考证过程总量key
    public static final String EXPORT_ADMISSION_TICKET_PROGRESS_TOTAL_KEY = "EXPORT_ADMISSION_TICKET_PROGRESS_TOTAL_KEY";
    //获取导出准考证过程完成数量key
    public static final String EXPORT_ADMISSION_TICKET_PROGRESS_KEY = "EXPORT_ADMISSION_TICKET_PROGRESS_KEY";
    //批次
    public static final String CREATE_TASK_TIME_KEY = "CREATE_TASK_TIME_KEY";
    //编排
    public static final String CREATE_TIME_ROOM_CANDIDATE_KEY = "CREATE_TIME_ROOM_CANDIDATE_KEY";
    // 生成准考证进度
    public static final String CREATE_ADMISSION_TICKET_PROGRESS_KEY = "CREATE_ADMISSION_TICKET_PROGRESS_KEY";
    // 生成准考证进度
    public static final String CREATE_ADMISSION_TICKET_PROGRESS_TOTAL_KEY = "CREATE_ADMISSION_TICKET_PROGRESS_TOTAL_KEY";

    public static final String ARRANGE_TOTAL_KEY = "ARRANGE_TOTAL_KEY";

    public static final String ARRANGE_PROGRESS_KEY = "ARRANGE_PROGRESS_KEY";

    public static final String ARRANGE_CANDIDATE_KEY = "ARRANGE_CANDIDATE_KEY";

    public static final String DATA_LOCK_KEY = "DATA_LOCK_KEY";

    public static final String DATA_LOCK_TOTAL_KEY = "DATA_LOCK_TOTAL_KEY";

    public static final String DATA_LOCK_PROGRESS_KEY = "DATA_LOCK_PROGRESS_KEY";

    public static final String DATA_LOCK_ERROR_KEY = "DATA_LOCK_ERROR_KEY";

    //批量导入照片，zip文件
    public static final String IMPORT_CANDIDATE_PHOTO = "IMPORT_CANDIDATE_PHOTO_KEY";

    //考务人员与批次关系
    public static final String USER_TIME_CACHE_KEY = "USER_TIME_CACHE_KEY";
    //考务人员与批次关系 -- 管理员
    public static final String USER_TIME_ADMIN_CACHE_KEY = "USER_TIME_ADMIN_CACHE_KEY";
    //考务人员与任务关系
    public static final String USER_TASK_CACHE_KEY = "USER_TASK_CACHE_KEY";
    // 机构模板样例
    public static final String TEMPLATE_EXAMPLE_CACHE_KEY = "TEMPLATE_EXAMPLE";

    public static final String KW_BINGBM_LOCK_KEY = "KW_BINGBM_LOCK_KEY";

    //考务绑定报名
    public static final String KW_BINGBM_PROCESS_CACHE_KEY = "KW_BINGBM_PROCESS_CACHE_KEY";


    public static String getBingingLockProgressKey(String taskId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, KW_BINGBM_PROCESS_CACHE_KEY, taskId);
    }

    /**
     * 获取防重复提交key（锁名称 + userId + 请求参数）
     * @param lockName 锁名称
     * @param userId 用户id
     * @param param 请求参数
     * @return 防重复提交key
     */
    public static String getNoRepeatCommitKey(String lockName, String userId, String param) {
        return StringUtils.joinWith(CACHE_SEPARATOR, lockName, userId, param);
    }

    /**
     * 获取生成考务包事务key
     * @param taskId 考试任务id
     * @return 生成考务包事务key
     */
    public static String getCreateRoomDataKey(String taskId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, CREATE_ROOM_DATA_KEY, taskId);
    }
    /**
     * 获取生成模拟测试考务包事务key
     * @param taskId 考试任务id
     * @return 生成考务包事务key
     */
    public static String getCreateMockRoomDataKey(String taskId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, CREATE_MOCK_ROOM_DATA_KEY, taskId);
    }

    /**
     * 获取生成考务包过程总量key
     * @param taskId 考试任务id
     * @return 生成考务包过程总量key
     */
    public static String getCreateRoomDataProgressTotalKey(String taskId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, CREATE_ROOM_DATA_PROGRESS_TOTAL_KEY, taskId);
    }

    /**
     * 获取生成模拟测试考务包过程总量key
     * @param taskId 考试任务id
     * @return 生成考务包过程总量key
     */
    public static String getCreateMockRoomDataProgressTotalKey(String taskId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, CREATE_MOCK_ROOM_DATA_PROGRESS_TOTAL_KEY, taskId);
    }

    /**
     * 获取生成考务包过程完成数量key
     * @param taskId 考试任务id
     * @return 生成考务包过程完成数量key
     */
    public static String getCreateRoomDataProgressKey(String taskId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, CREATE_ROOM_DATA_PROGRESS_KEY, taskId);
    }

    /**
     * 获取生成模拟测试考务包过程完成数量key
     * @param taskId 考试任务id
     * @return 生成考务包过程完成数量key
     */
    public static String getCreateMockRoomDataProgressKey(String taskId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, CREATE_MOCK_ROOM_DATA_PROGRESS_KEY, taskId);
    }

    /**
     * 获取导出准考证事务key
     * @param taskId 考试任务id
     * @param userId 用户id
     * @return 导出准考证事务key
     */
    public static String getExportAdmissionTicketKey(String taskId, String userId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, EXPORT_ADMISSION_TICKET_KEY, taskId, userId);
    }

    /**
     * 获取导出准考证过程总量key
     * @param taskId 考试任务id
     * @param userId 用户id
     * @return 导出准考证过程总量key
     */
    public static String getExportAdmissionTicketProgressTotalKey(String taskId, String userId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, EXPORT_ADMISSION_TICKET_PROGRESS_TOTAL_KEY, taskId, userId);
    }

    /**
     * 获取导出准考证过程完成数量key
     * @param taskId 考试任务id
     * @param userId 用户id
     * @return 导出准考证过程完成数量key
     */
    public static String getExportAdmissionTicketProgressKey(String taskId, String userId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, EXPORT_ADMISSION_TICKET_PROGRESS_KEY, taskId, userId);
    }

    /**
     * 生成准考证key获取
     * @param taskId
     * @return
     */
    public static String getCreateAdmissionTicketKey(String taskId){
        return StringUtils.joinWith(CACHE_SEPARATOR, CREATE_ADMISSION_TICKET_KEY, taskId);
    }

    /**
     * 生成批次key获取
     * @param taskId
     * @return
     */
    public static String getCreateTimeKey(String taskId){
        return StringUtils.joinWith(CACHE_SEPARATOR, CREATE_TASK_TIME_KEY, taskId);
    }

    /**
     * 生成编排key获取
     * @param taskId
     * @return
     */
    public static String getCreateTimeRoomCandidateKey(String taskId){
        return StringUtils.joinWith(CACHE_SEPARATOR, CREATE_TIME_ROOM_CANDIDATE_KEY, taskId);
    }

    public static String getCreateAdmissionTicketProgressKey(String taskId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, CREATE_ADMISSION_TICKET_PROGRESS_KEY, taskId);
    }

    public static String getCreateAdmissionTicketProgressTotalKey(String taskId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, CREATE_ADMISSION_TICKET_PROGRESS_TOTAL_KEY, taskId);
    }

    public static String getArrangeCandidateKey(String taskId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, ARRANGE_CANDIDATE_KEY, taskId);
    }

    public static String getArrangeTotalKey(String taskId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, ARRANGE_TOTAL_KEY, taskId);
    }

    public static String getArrangeProgressKey(String taskId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, ARRANGE_PROGRESS_KEY, taskId);
    }

    public static String getDataLockKey(String taskId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, DATA_LOCK_KEY, taskId);
    }

    public static String getDataLockTotalKey(String taskId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, DATA_LOCK_TOTAL_KEY, taskId);
    }

    public static String getDataLockProgressKey(String taskId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, DATA_LOCK_PROGRESS_KEY, taskId);
    }

    public static String getDataLockErrKey(String taskId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, DATA_LOCK_ERROR_KEY, taskId);
    }

    public static String getImportCandidatePhotoKye(String taskId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, IMPORT_CANDIDATE_PHOTO, taskId);
    }

    //考务人员与批次关系
    public static String getUserTimeKey(String timeId,String userId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, USER_TIME_CACHE_KEY, timeId,userId);
    }

    //考务人员与任务关系
    public static String getUserTaskKey(String taskId,String userId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, USER_TASK_CACHE_KEY, taskId,userId);
    }

    //考务人员与批次关系-- 管理员
    public static String getUserTimeAdminKey(String timeId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, USER_TIME_ADMIN_CACHE_KEY, timeId);
    }

    public static String getOfficeTemplateExampleKey(String templateId, String officeId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, TEMPLATE_EXAMPLE_CACHE_KEY, officeId, templateId);
    }

    public static String getKwBingDataLockKey(String taskId) {
        return StringUtils.joinWith(CACHE_SEPARATOR, KW_BINGBM_LOCK_KEY, taskId);
    }
}
